package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.dto.NursingProjectPageParamDto;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信小程序端 --- 服务页面接口
 */

@Slf4j
@RestController
@RequestMapping("/customer/orders/project")
@Api(tags = "客户服务项")
public class CustomerOrdersController extends BaseController {

    @Autowired
    private NursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation(value = "分页查询护理项目")
    public ResponseResult<PageResponse<NursingProjectVo>> getByPage(NursingProjectPageParamDto nursingProjectPageParamDto){
        log.info("查询护理项目:{}", nursingProjectPageParamDto);
        PageResponse<NursingProjectVo> result = nursingProjectService.selectByPage(nursingProjectPageParamDto);
        return success(result);
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID查询")
    public ResponseResult<NursingProjectVo> getById(@ApiParam(value = "项目ID",required = true)
                                        @PathVariable Integer id){
        log.info("查询项目详情，ID：{}",id);
        NursingProjectVo result = nursingProjectService.getById(id);
        return success(result);
    }

}
